<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习题1</title>
    <style>
        main{
            border: 1px solid #f00;
            width: 500px;
            height: 300px;
            text-align: center;
        }
        nav{
            width: 100%;
            border-bottom: 1px solid #999;
            position: relative;
            height: 41px;
        }
        nav::after{
            clear: both;
            display: table;
            content: '';
        }
        ul{
            padding: 0;
            margin: 0;
            list-style: none;
            float: left;
            position: absolute;
            left: 0;
            top: 0;
        }
        ul li{
            width: 70px;
            height: 40px;
            line-height: 40px;
            position: relative;
            border-right: 1px solid green;
            border-top: 1px solid green;
            float: left;
            border-bottom: 1px solid transparent;
        }
        ul .liactive{
            border-bottom: 1px solid white;
        }
        ul li span:first-child input{
            width: 50px;
        }
        .icon{
            position: absolute;
            right: 0;
            top: 0;
            width: 20px;
            height: 20px;
            line-height: 20px;
            cursor: pointer;
            z-index: 1000;
        }
        .tabadd{
            float: right;
        }
        .tabscon section{
            display: none;
            height: 180px;
        }
        .tabscon .conactive{
            display: block;
        }
    </style>
</head>
<body>
    <main id="main">
        <h4>Js 面向对象 动态添加标签页</h4>
        <!-- tab 标签 -->
        <nav class="first">
            <ul>
                <li class="liactive">
                    <span>测试1</span>
                    <span class="icon">-</span>
                </li>
                <li>
                    <span>测试2</span>
                    <span class="icon">-</span>
                </li>
                <li>
                    <span>测试3</span>
                    <span class="icon">-</span>
                </li>
            </ul>
            <div class="tabadd">
                <span style="cursor: pointer;">+</span>
            </div>
        </nav>
        <div class="tabscon">
            <section class="conactive">测试1</section>
            <section>测试2</section>
            <section>测试3</section>
        </div>
    </main>
    <script src="tab.js"></script>
</body>
</html>